<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>待审核订单</title>
    <c:import url="../../header.jsp"/>
</head>
<body>
<div class="content-warp">
    <div class="screen-tab-warp">
        <ul class="screen-tab">
            <li class="active tab-switch"  data-target="0"><a href="javascript:void(0)">退单待审核</a></li>
            <li class="tab-switch" data-target="1"><a href="javascript:void(0)">废单待审核</a></li>
            <li class="tab-switch" data-target="2"><a href="javascript:void(0)">完结待审核</a></li>
        </ul>
    </div>
    <div  id="auditOrder"></div>
</div>
<c:import url="../../footer.jsp"/>
<script>
    var tables;
    var auditOrder = {
        "list":sysInfo.basePath+"/rzsc/audit_order/list.do",//分页数据
        "abandonPage": sysInfo.basePath+"/rzsc/audit_order/abandon_page.html",
        "nullifyPage": sysInfo.basePath+"/rzsc/audit_order/nullify_page.html",
        "completionReviewPage": sysInfo.basePath+"/rzsc/audit_order/completion_review_page.html",
    }
    var codes = '${code}';
    var timeout = '${TIME_OUT}';
    var i=0;
    dggui.use(['table', 'select2','distpicker','dggdate'], function (){
        var table = dggui.table;
        var select2 = dggui.select2;
        var dggdate = dggui.dggdate;
        if(!isEmpty(codes)){
            if(codes == 'RZSCORDER_STATUS05'){
                $(".screen-tab li:eq(0)").addClass("active");
                $(".screen-tab li:eq(1)").removeClass("active");
                $(".screen-tab li:eq(2)").removeClass("active");
                abandonPage();
            }else if(codes == 'RZSCORDER_STATUS07'){
                $(".screen-tab li:eq(1)").addClass("active");
                $(".screen-tab li:eq(0)").removeClass("active");
                $(".screen-tab li:eq(2)").removeClass("active");
                nullifyPage();
            }else if(codes == 'RZSCORDER_STATUS22'){
                $(".screen-tab li:eq(2)").addClass("active");
                $(".screen-tab li:eq(0)").removeClass("active");
                $(".screen-tab li:eq(1)").removeClass("active");
                completionReviewPage();
            }
        }else{
            //打开退单页面
            abandonPage();
        }
        $(".tab-switch").click(function () {
            $(this).addClass("active").siblings().removeClass("active");
            switch ($(".active").attr("data-target")) {
                case "0":
                    dggui.dialog.loading();
                    //打开退单页面
                    abandonPage();
                    // tables.ajax.reload();
                    break;
                case "1":
                    dggui.dialog.loading();
                    //打开废单页面
                    nullifyPage();
                    // tables.ajax.reload();
                    break;
                case "2":
                    dggui.dialog.loading();
                    //打开完结页面
                    completionReviewPage();
                    // tables.ajax.reload();
                    break;
                default :
                    dggui.dialog.loading();
                    //打开退单页面
                    abandonPage();
                    // tables.ajax.reload();
                    break;

            }
        });
        //完结待审核页面
        function completionReviewPage() {
            $.ajax({
                url: auditOrder.completionReviewPage,
                dataType: 'html',
                success: function (html) {
                    dggui.dialog.loading('close');
                    $("#auditOrder").html(html);
                    //初始化所属生产事业部
                    syb("#productOrgId");
                    select2.render({
                        placeholder: "请选择",
                        elem: $('#productOrgId'),
                        allowClear: true,
                        width: "190px"
                    });
                    //初始化流程人员
                    initUser("RZSC_FLOW_USER","role","#flowUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#flowUserId'),
                        width: "190px"
                    });
                    //初始化接单时间
                    dggdate.render({
                        elem: '#receiveOrderDate',
                        type: 'date',
                        range: '~'
                    });
                    var opt={
                        "elem":"#completionReviewOrder",
                        "ajax": auditOrder.list,
                        "scrollX": "true",//是否开启横项滚动
                        "paging": "true",
                        "switchStatus": "completionReviewOrder",
                        "fixedColumns": {//锁定列，只有开启scrollX时才生效
                            "leftColumns": 4,//左侧锁定2列
                            "rightColumns": 1//右侧锁定1列
                        },
                        "fnServerParams": function (aoData) {
                            //搜索条件
                            aoData = $.extend(aoData, {
                                    target:$(".active").attr("data-target"),
                                    productOrgId:$("#productOrgId").val(),
                                    flowUserId:$("#flowUserId").val(),
                                    receiveOrderDate:$("#receiveOrderDate").val(),
                                    searchKey:$("#searchKey").val(),
                                    audit: $("#audit").val(),
                                    customerName:$("#customerName").val(),
                                }
                            )
                            return aoData;
                        },
                        "aoColumns": [{
                            "sClass": "check-th",
                            "orderable": false,
                            "title": "<input type='checkbox'  class='checkall'>",
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return '<input type="checkbox" class="checkchild" name="checkchild" value="' + data + '">';
                            }
                        }, {
                            'title': '序号',
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return meta.row + 1;
                            }
                        },
                            {
                                'title': '所属生产事业部',
                                'data': "productOrgName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render"><b>'+data ? data : ''+'<b></div>';
                                    return htm;
                                }
                            },
                            {
                                "title": "订单编号",
                                "orderable": false,
                                "data": "orderNo",
                                "render": function (data, type, full, meta) {
                                    return ('<a href="javascript:;" class="dggui-link"  onclick="openBusinessDetail(\'' + full.orderNo + '\',\'' + full.orderId + '\')" /><span>' + data + '</span></a>');
                                    /*return data;*/
                                }
                            },
                            {
                                'title': '生产订单编号',
                                'data': "scProductOrderNo",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="openOrderInfoDetail(\''+data+'\',\''+row.id+'\')">'+data+'</a>';
                                    return htm;
                                }
                            }, {
                                'title': '客户',
                                'data': "customerName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                        '<p><span>' +emptyStringConvert(row.customerName) + '</span></p>' +
                                        '<p>' + emptyStringConvert(row.customerPhone) + '</p>' +
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                "title":"合同编号",
                                "orderable": false,
                                "data": "contractNo",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                'title': '当前完成节点',
                                'data': "latestEndNodeName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.latestEndNodeName) + '<p>' + emptyStringConvert(row.latestEndNodeTime) + '</p>';
                                }
                            },
                            {
                                'title': '业务类型',
                                'data': "businessProductName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data ? data : ''+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '产品',
                                'data': "productName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '渠道',
                                'data': "channelName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm;
                                    if(!isEmpty(data)){
                                        if(data.length > 20){
                                            htm = '<div class="order-render"><p class="line1" title="'+data+'"><span >'+ data.substring(0,15)+'...' +'</span></p></div>'
                                        }else{
                                            htm = '<div class="order-render"><p class="line1" title="'+data+'"><span >' + data + '</span></p></div>'
                                        }
                                    }else{
                                        htm = '<div class="order-render"><p class="line1"><span > - </span></p></div>'
                                    }
                                    return htm;
                                }
                            },
                            {
                                'title': '流程人员',
                                'data': "flowUserName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '签单时间',
                                'data': "signTime",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '签单商务/部门',
                                "orderable": false,
                                'data': "signUserName",
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.signUserName) + '<p>' + emptyStringConvert(row.signUserOrgName) + '</p>';
                                }
                            },
                            {
                                'title': '放款时间',
                                'data': "loanTime",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '接单时间',
                                'data': "receiveOrderDate",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '来源方式',
                                'data': "originCode",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '需求金额（元）',
                                'data': "loanAmount",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '操作',
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="auditOrderDialogOne(\''+row.id+'\',$(\'#completionReviewOrder\'));">审核</a>';
                                    return htm;
                                }
                            }
                        ],
                        "columnDefs": [{
                            targets: [3], //第1，2，3列
                            createdCell: function (td, cellData, rowData, row, col) {
                                if (rowData.orderTimeStatus == timeout) {
                                    $(td).parent().addClass("red");//订单超期
                                    return;
                                } else if (rowData.nodeTimeStatus == timeout) {//节点超期
                                    $(td).parent().addClass("green");
                                    return;
                                }
                            }
                        }]
                    };
                    tables=table.render(opt);
                    $('.searchBtn').click(function (){
                        // var moneyMax = $("#moneyMax").val().trim();
                        // var moneyMin = $("#moneyMin").val().trim();
                        /*  if(!checkMoneySearch(moneyMin,moneyMax)){
                              return false;
                          }*/
                        tables.ajax.reload();
                    });
                    // 处理dataTable 异常错误信息
                    $.fn.dataTable.ext.errMode = 'none';//不抛出异常
                    tables.on( 'error.dt', function ( e, settings, techNote, message ) {
                        //dggui.dialog.errors("表格查询错误，请联系管理员", 2000);
                        if(checkEmpty(settings.jqXHR.responseJSON.error)){dggui.dialog.errors(settings.jqXHR.responseJSON.error, 2000);}
                    });
                }
            });
        };

        //退单页面
        function abandonPage() {
            $.ajax({
                url: auditOrder.abandonPage,
                dataType: 'html',
                success: function (html) {
                    dggui.dialog.loading('close');
                    $("#auditOrder").html(html);
                    //初始化所属生产事业部
                    syb("#productOrgId");
                    select2.render({
                       placeholder: "请选择",
                        elem: $('#productOrgId'),
                        allowClear: true,
                        width: "190px"
                    });
                    //初始化流程人员
                    initUser("RZSC_FLOW_USER","role","#flowUserId");
                    select2.render({
                       placeholder: "请选择",
                        allowClear: true,
                        elem: $('#flowUserId'),
                        width: "190px"
                    });
                    //初始化申请退单时间
                    dggdate.render({
                        elem: '#abandonReasonTime',
                        type: 'date',
                        range: '~'
                    });
                    //初始化接单时间
                    dggdate.render({
                        elem: '#receiveOrderDate',
                        type: 'date',
                        range: '~'
                    });
                    var opt={
                        "elem":"#abandonOrder",
                        "ajax": auditOrder.list,
                        "scrollX": "true",//是否开启横项滚动
                        "paging": "true",
                        "switchStatus": "abandonOrder",
                        "fixedColumns": {//锁定列，只有开启scrollX时才生效
                            "leftColumns": 4,//左侧锁定2列
                            "rightColumns": 1//右侧锁定1列
                        },
                        "fnServerParams": function (aoData) {
                            // var moneyMax = $("#moneyMax").val().trim();
                            // var moneyMin = $("#moneyMin").val().trim();
                            //搜索条件
                            aoData = $.extend(aoData, {
                                    target:$(".active").attr("data-target"),
                                    // customerPhone:$("#customerPhone").val(),
                                    productOrgId:$("#productOrgId").val(),
                                    // typeCode:$("#typeCode .plug-in-code").val(),
                                    // productId:$("#productCode").val(),
                                    // channelId:$("#channelCode").val(),
                                    // businessProductCode:$("#productCode").val(),
                                    flowUserId:$("#flowUserId").val(),
                                    abandonReasonTime:$("#abandonReasonTime").val(),
                                    // signTime:$("#signTime").val(),
                                    receiveOrderDate:$("#receiveOrderDate").val(),
                                    searchKey:$("#searchKey").val(),
                                    audit: $("#audit").val(),
                                    // signOrgOrBusId:$("#signOrg").attr("data-id"),
                                    // moneyMax:moneyMax,
                                    // moneyMin:moneyMin,
                                    customerName:$("#customerName").val(),

                                }
                            )
                            return aoData;
                        },
                        "aoColumns": [{
                            "sClass": "check-th",
                            "orderable": false,
                            "title": "<input type='checkbox'  class='checkall'>",
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return '<input type="checkbox" class="checkchild" name="checkchild" value="' + data + '">';
                            }
                        }, {
                            'title': '序号',
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return meta.row + 1;
                            }
                        },
                            {
                                'title': '状态',
                                'data': "status",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render"><b>'+data ? data : ''+'<b></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '所属生产事业部',
                                'data': "productOrgName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render"><b>'+data ? data : ''+'<b></div>';
                                    return htm;
                                }
                            },
                            {
                                "title": "订单编号",
                                "orderable": false,
                                "data": "orderNo",
                                "render": function (data, type, full, meta) {
                                    return ('<a href="javascript:;" class="dggui-link"  onclick="openBusinessDetail(\'' + full.orderNo + '\',\'' + full.orderId + '\')" /><span>' + data + '</span></a>');
                                    /*return data;*/
                                }
                            },
                            {
                                'title': '生产订单编号',
                                'data': "scProductOrderNo",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="openOrderInfoDetail(\''+data+'\',\''+row.id+'\')">'+data+'</a>';
                                    return htm;
                                }
                            }, {
                                'title': '客户',
                                'data': "customerName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                        '<p><span>' +emptyStringConvert(row.customerName) + '</span></p>' +
                                        '<p>' + emptyStringConvert(row.customerPhone) + '</p>' +
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                "title":"合同编号",
                                "orderable": false,
                                "data": "contractNo",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                'title': '业务类型',
                                'data': "businessProductName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data ? data : ''+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '产品',
                                'data': "productName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '商品属性',
                                'data': "goodsName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '渠道',
                                'data': "channelName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm;
                                    if(!isEmpty(data)){
                                        if(data.length > 20){
                                            htm = '<div class="order-render"><p class="line1" title="'+data+'"><span >'+ data.substring(0,15)+'...' +'</span></p></div>'
                                        }else{
                                            htm = '<div class="order-render"><p class="line1" title="'+data+'"><span >' + data + '</span></p></div>'
                                        }
                                    }else{
                                        htm = '<div class="order-render"><p class="line1"><span > - </span></p></div>'
                                    }
                                    return htm;
                                }
                            },
                            {
                                'title': '申请退单时间',
                                'data': "abandonReasonTime",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },

                            {
                                'title': '申请人',
                                'data': "abandonUser",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '签单商务/部门',
                                "orderable": false,
                                'data': "signUserName",
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.signUserName) + '<p>' + emptyStringConvert(row.signUserOrgName) + '</p>';
                                }
                            },
                            {
                                'title': '流程人员',
                                'data': "flowUserName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '当前审核人',
                                'data': "auditorName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '退单理由',
                                'data': "abandonReason",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '签单时间',
                                'data': "signTime",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '接单时间',
                                'data': "receiveOrderDate",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },

                            {
                                'title': '需求金额（元）',
                                'data': "loanAmount",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '最新备注',
                                'data': "lastRemark",
                                "orderable": false,
                                "render": function (data, type, row, meta) {
                                    return '<div class="line1" title="'+data+'"><p>' + strInterception(data,10) + '</p></div>' + '<p>'+emptyStringConvert(row.lastRemarkTime)+'</p>';
                                }
                            },{
                                'title': '操作',
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="remarkOrder(\''+row.id+'\',$(\'#auditOrder\'));">备注</a>';
                                    return htm;
                                }
                            }
                        ],
                        "columnDefs": [{
                            targets: [3], //第1，2，3列
                            createdCell: function (td, cellData, rowData, row, col) {
                                if (rowData.orderTimeStatus == timeout) {
                                    $(td).parent().addClass("red");//订单超期
                                    return;
                                } else if (rowData.nodeTimeStatus == timeout) {//节点超期
                                    $(td).parent().addClass("green");
                                    return;
                                }
                            }
                        }]
                    };
                    tables=table.render(opt);
                    $('.searchBtn').click(function (){
                        // var moneyMax = $("#moneyMax").val().trim();
                        // var moneyMin = $("#moneyMin").val().trim();
                      /*  if(!checkMoneySearch(moneyMin,moneyMax)){
                            return false;
                        }*/
                        tables.ajax.reload();
                    });
                    // 处理dataTable 异常错误信息
                    $.fn.dataTable.ext.errMode = 'none';//不抛出异常
                    tables.on( 'error.dt', function ( e, settings, techNote, message ) {
                        //dggui.dialog.errors("表格查询错误，请联系管理员", 2000);
                       if(checkEmpty(settings.jqXHR.responseJSON.error)){dggui.dialog.errors(settings.jqXHR.responseJSON.error, 2000);}
                    });
                }
            });
        };

        //废单页面
        function nullifyPage() {
            $.ajax({
                url: auditOrder.nullifyPage,
                dataType: 'html',
                success: function (html) {
                    dggui.dialog.loading('close');
                    $("#auditOrder").html(html);
                    //初始化所属生产事业部
                    syb("#productOrgId");
                    select2.render({
                       placeholder: "请选择",
                        elem: $('#productOrgId'),
                        allowClear: true,
                        width: "190px"
                    });
                    // 加载部门下拉框
                    // queryAllDep("#signOrg");
                    //初始化流程人员
                    initUser("RZSC_FLOW_USER","role","#flowUserId");
                    select2.render({
                       placeholder: "请选择",
                        allowClear: true,
                        elem: $('#flowUserId'),
                        width: "190px"
                    });
                    //初始化申请退单时间
                    dggdate.render({
                        elem: '#abandonReasonTime',
                        type: 'date',
                        range: '~'
                    });
                    //初始化接单时间
                    dggdate.render({
                        elem: '#receiveOrderDate',
                        type: 'date',
                        range: '~'
                    });
                    var opt={
                        "elem":"#nullifyOrder",
                        "ajax": auditOrder.list,
                        "scrollX": "true",//是否开启横项滚动
                        "paging": "true",
                        "switchStatus": "nullifyOrder",
                        "fixedColumns": {//锁定列，只有开启scrollX时才生效
                            "leftColumns": 4,//左侧锁定2列
                            "rightColumns": 1//右侧锁定1列
                        },
                        "fnServerParams": function (aoData) {
                           /* var moneyMax = $("#moneyMax").val().trim();
                            var moneyMin = $("#moneyMin").val().trim();*/
                            //搜索条件
                            aoData = $.extend(aoData, {
                                target:$(".active").attr("data-target"),
                                // customerPhone:$("#customerPhone").val(),
                                productOrgId:$("#productOrgId").val(),
                                // typeCode:$("#typeCode .plug-in-code").val(),
                                // productId:$("#productCode").val(),
                                // channelId:$("#channelCode").val(),
                                // businessProductCode:$("#productCode").val(),
                                flowUserId:$("#flowUserId").val(),
                                abandonReasonTime:$("#abandonReasonTime").val(),
                                // signTime:$("#signTime").val(),
                                receiveOrderDate:$("#receiveOrderDate").val(),
                                searchKey:$("#searchKey").val(),
                                audit: $("#audit").val(),
                                // signOrgOrBusId:$("#signOrg").attr("data-id"),
                                // moneyMax:moneyMax,
                                // moneyMin:moneyMin,
                                customerName:$("#customerName").val(),
                                }
                            )
                            return aoData;
                        },
                        "aoColumns": [{
                            "sClass": "check-th",
                            "orderable": false,
                            "title": "<input type='checkbox'  class='checkall'>",
                            "render": function(data, type, full, meta) {
                                return '<input type="checkbox" class="checkchild" name="checkchild" value="' + data + '">';
                            }
                        }, {
                            'title': '序号',
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return meta.row + 1;
                            }
                        },
                            {
                                'title': '所属生产事业部',
                                'data': "productOrgName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render"><b>'+data ? data : ''+'<b></div>';
                                    return htm;
                                }
                            },
                            {
                                "title": "订单编号",
                                "orderable": false,
                                "data": "orderNo",
                                "render": function (data, type, full, meta) {
                                    return ('<a href="javascript:;" class="dggui-link"  onclick="openBusinessDetail(\'' + full.orderNo + '\',\'' + full.orderId + '\')" /><span>' + data + '</span></a>');
                                    /*return data;*/
                                }
                            },
                            {
                                'title': '生产订单编号',
                                "orderable": false,
                                'data': "scProductOrderNo",
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="openOrderInfoDetail(\''+data+'\',\''+row.id+'\')">'+data+'</a>';
                                    return htm;
                                }
                            }, {
                                'title': '客户',
                                "orderable": false,
                                'data': "customerName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                        '<p><span>' +emptyStringConvert(row.customerName) + '</span></p>' +
                                        '<p>' + emptyStringConvert(row.customerPhone) + '</p>' +
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                "title":"合同编号",
                                "orderable": false,
                                "data": "contractNo",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                'title': '业务类型',
                                "orderable": false,
                                'data': "businessProductName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data ? data : ''+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '产品',
                                "orderable": false,
                                'data': "productName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '商品属性',
                                'data': "goodsName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '渠道',
                                "orderable": false,
                                'data': "channelName",
                                "render": function(data, type, row, meta) {
                                    var htm;
                                    if(!isEmpty(data)){
                                        if(data.length > 20){
                                            htm = '<div class="order-render"><p class="line1" title="'+data+'"><span >'+ data.substring(0,15)+'...' +'</span></p></div>'
                                        }else{
                                            htm = '<div class="order-render"><p class="line1" title="'+data+'"><span >' + data + '</span></p></div>'
                                        }
                                    }else{
                                        htm = '<div class="order-render"><p class="line1"><span > - </span></p></div>'
                                    }
                                    return htm;
                                }
                            }, {
                                'title': '申请废单时间',
                                "orderable": false,
                                'data': "abandonReasonTime",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '申请人',
                                "orderable": false,
                                'data': "abandonUser",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '签单商务/部门',
                                "orderable": false,
                                'data': "signUserName",
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.signUserName) + '<p>' + emptyStringConvert(row.signUserOrgName) + '</p>';
                                }
                            },
                            {
                                'title': '流程人员',
                                "orderable": false,
                                'data': "flowUserName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '当前审核人',
                                "orderable": false,
                                'data': "auditorName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '废单理由',
                                "orderable": false,
                                'data': "abandonReason",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '签单时间',
                                'data': "signTime",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '接单时间',
                                'data': "receiveOrderDate",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },

                            {
                                'title': '需求金额（元）',
                                "orderable": false,
                                'data': "loanAmount",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '最新备注',
                                'data': "lastRemark",
                                "orderable": false,
                                "render": function (data, type, row, meta) {
                                    return '<div class="line1" title="'+data+'"><p>' + strInterception(data,10) + '</p></div>' + '<p>'+emptyStringConvert(row.lastRemarkTime)+'</p>';
                                }
                            },
                            {
                                'title': '操作',
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="remarkOrder(\''+row.id+'\',$(\'#auditOrder\'));">备注</a>';
                                    return htm;
                                }
                            }
                        ],
                        "columnDefs": [{
                            targets: [3], //第1，2，3列
                            createdCell: function (td, cellData, rowData, row, col) {
                                if (rowData.orderTimeStatus == timeout) {
                                    $(td).parent().addClass("red");//订单超期
                                    return;
                                } else if (rowData.nodeTimeStatus == timeout) {//节点超期
                                    $(td).parent().addClass("green");
                                    return;
                                }
                            }
                        }]
                    };
                    tables=table.render(opt);
                    $('.searchBtn').click(function (){

                        tables.ajax.reload();
                    });
                    // 处理dataTable 异常错误信息
                    $.fn.dataTable.ext.errMode = 'none';//不抛出异常
                    tables.on( 'error.dt', function ( e, settings, techNote, message ) {
                        //dggui.dialog.errors("表格查询错误，请联系管理员", 2000);
                       if(checkEmpty(settings.jqXHR.responseJSON.error)){dggui.dialog.errors(settings.jqXHR.responseJSON.error, 2000);}
                    });
                }
            });
        }

    });

    function excelExportAudit() {
         var obj = new Object();
         obj.target=$(".active").attr("data-target");
         obj.productOrgId=$("#productOrgId").val();
         obj.flowUserId=$("#flowUserId").val();
         obj.abandonReasonTime=$("#abandonReasonTime").val();
         obj.receiveOrderDate=$("#receiveOrderDate").val();
         obj.searchKey=$("#searchKey").val();
         obj.audit=$("#audit").val();
         obj.customerName = $("#customerName").val();
        formSubmit('${basePath}/rzsc/audit_order/excel_export_nullify_audit.do', obj);
    };

</script>
</body>
</html>